function searchBy(obj,key) {
	var uri = window.location.href;
	var separator = uri.indexOf("?")===-1?"?":"&";
	//去除路径中的page参数
	if (uri.indexOf("page")!==-1){
		var rep = new RegExp("page=.");
		uri = uri.replace(rep,"");
		alert(uri);
	}
	if (uri.indexOf(key)!==-1){
		return;
	}
	uri = uri+separator+key+"="+$(obj).text();
	uri = uri.replace("?&","?");
	uri = uri.replace("&&","&");
	window.location.href = uri;

	// $.ajax({
	// 	type: 'GET',
	// 	url: uri,
	// 	success: function (result) {
	// 		if (result.resultCode === 200) {
	// 			// window.location.reload();
	// 		} else {
	// 			alert("error");
	// 		}
	// 	},
	// 	error: function () {
	// 		alert("error2");
	// 	}
	// });
}

function clearAll() {
	var uri = window.location.href;
	uri = uri.substr(0,uri.indexOf("?"))
	window.location.href = uri
}


function clearBrandSearch(name) {
	var uri = window.location.href + "&";
	var reg = new RegExp("brand=(^&)*&");
	uri.search(reg)
	// uri = uri.replace(reg,"");
	// uri = uri.replace("brand="+name,"");
	// uri = uri.replace("?&","?");
	// uri = uri.replace("&&","&");
	alert(uri.search("brand"));
}

function clearCategorySearch(name) {
	var uri = window.location.href + "&";
	var reg = new RegExp("category=(^&)*&");
	uri = uri.replace(reg,"");
	uri = uri.replace("category="+name,"");
	uri = uri.replace("?&","?");
	uri = uri.replace("&&","&");
	alert(uri);
}
